package com.sumainfor.wx.tenant.service.impl;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.tenant.feign.MarketFeignClient;
import com.sumainfor.wx.tenant.feign.OperationsFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 功能描述:
 * 业主相关
 * @Auther: zhlu
 * @Date: 2019/4/1 10:13
 * @Description:
 */
@Service
public class OwnerService {

    @Autowired
    MarketFeignClient MarketFeignClient;

    @Autowired
    OperationsFeignClient OperationsFeignClient;

    /**
     * 功能描述: 
     * 根据phone获取当前业主托管房源总数与账单总数
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/1 10:15
     */
    public Map<String,Object> getWechatOwnerCount(Map<String,Object>params){
        Map<String,Object> result=new HashMap<String,Object>();
        JsonResult<Map<String, Object>> jsonResult1 = MarketFeignClient.getWechatOwnerCount(params);
        if (jsonResult1.isSuccess() == false) {
            result.put("hostedCount",0);
        }else{
            result.put("hostedCount",jsonResult1.getResult());
        }
        JsonResult<Map<String, Object>> jsonResult2 = OperationsFeignClient.getOwnerBillAllCount(params);
        if (jsonResult2.isSuccess() == false) {
            result.put("ownerCount",0);
        }else{
            result.put("ownerCount",jsonResult2.getResult());
        }
        return result;
    }

}
